{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">部门列表(权限组)</li>
            <li class=""><a href="{:url('admin/auth_group/add')}">添加部门(权限组)</a></li>
        </ul>
        <div class="layui-tab-content">

            <form class="layui-form layui-form-pane" action="{:url('admin/auth_group/index')}" method="get">
                <div class="layui-elem-quote  title-select">
                <div class="layui-inline">
                    <label class="layui-form-label">部门名称</label>
                    <div class="layui-input-inline">
                        <input type="text" name="keyword" value="{$keyword}" placeholder="请输入部门名称" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn">搜索</button>
                </div>
                </div>
            </form>
            <hr>




            <div class="layui-tab-item layui-show">
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th style="width: 30px;">ID</th>
                        <th>部门名称</th>
                        <th>职能描述</th>
                        <th>成员数量</th>
                        <th>添加时间</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {foreach name="auth_group_list" item="vo"}
                    <tr>
                        <td>{$vo.id}</td>
                        <td>{$vo.title}</td>
                        <td>{$vo.description}</td>
                        <td>{$vo.department_num}</td>
                        <td>{$vo.create_time}</td>
                        <td class="layui-form">

                            <input type="checkbox" name="online_type" value="{$vo.id}" lay-skin="switch"
                                   lay-text="ON|OFF" lay-filter="changeStatus"
                                   {if $vo.status == 1}
                                   checked
                                   {/if}
                            ></td>

                        <td>
                            <a href="{:url('admin/auth_group/auth',['id'=>$vo['id']])}" class="layui-btn layui-btn-mini">权限设置</a>
                            <a href="{:url('admin/auth_group/edit',['id'=>$vo['id']])}" class="layui-btn layui-btn-normal layui-btn-mini">编辑</a>
                            <a href="{:url('admin/auth_group/delete',['id'=>$vo['id']])}" class="layui-btn layui-btn-danger layui-btn-mini ajax-delete">删除</a>
                        </td>
                    </tr>
                    {/foreach}
                    </tbody>
                </table>
                {$auth_group_list->render()}
            </div>
        </div>
    </div>
</div>
{/block}


{block name="script"}

<script type="text/javascript">
    //监听指定开关
    form.on('switch(changeStatus)', function (data) {
        changeStatus(data, 2, '/admin/auth_group/changeStatus');
    });
</script>
{/block}
